home *** CD-ROM | disk | FTP | other *** search
- ;;---------------------------------------------------------------------------
- ;;-------------------- ----------------------
- ;;-------------------- IFR CONDITION <INSTRUCTIONS> ----------------------
- ;;-------------------- ----------------------
- ;;---------------------------------------------------------------------------
-
-
- IFR MACRO CONDITION, INSTRUCTIONS
- LOCAL DO, DONT
- J&CONDITION SHORT DO
- JMP SHORT DONT
- DO: INSTRUCTIONS
- DONT:
- ENDM
-
-
- ;; CONDITION may be any valid condition of the conditional JMP instruction.
- ;; i.e. A, AE, B, BE, C, E, G, GE, L, LE, NA, NAE, NB, NBE, NC, NE, NG,
- ;; NGE, NL, NLE, NO, NP, NS, NZ, O, P, PE, PO, S, Z, CXZ.
- ;;
- ;; <INSTRUCTIONS> are any valid assembly instructions. i.e. <jmp label>,
- ;; <mov reg, value>, <int xx>, etc. The left and right arrows are required.
- ;;
- ;; If an invalid condition is used, you will receive a SYNTAX ERROR for the
- ;; source line responsible. If an invalid instruction is used, you will
- ;; receive whatever ERROR is appropriate, on the source line responsible.
- ;;
- ;;
- ;; This macro is useful for writing structured assembler code. If you
- ;; have ever written the following type of code, this macro is for you:
- ;;
- ;; TST AX, 0FFh
- ;; JNE G1
- ;; JMP G2
- ;; G1: MOV AX, 0FF01h
- ;; G2: more code. . .
- ;;
- ;; With my macro installed, this could be re-written:
- ;;
- ;; TST AX, 0FFh
- ;; IFR NE <mov AX, 0FF01h>
- ;;
- ;; You need not worry about naming a label, and you save a line of source,
- ;; besides making your program more readable. It is useful when you need
- ;; to make a conditional jump of more than +/- 128 bytes.
- ;;
- ;; TST AX, 0FFh
- ;; JNZ G1:
- ;; JMP ISZERO
- ;; G1: more code. . .
- ;;
- ;; With my macro installed, this could be re-written:
- ;;
- ;; TST AX, 0FFh
- ;; IFR Z <jmp iszero>
- ;;
- ;; Again, it is much easier to write and read. For your information, it
- ;; would assemble like this:
- ;;
- ;; JZ ??0001
- ;; JMP ??0002
- ;; ??0001: JMP ISZERO
- ;; ??0002:
- ;;
- ;; Each time the macro is called, different numbers are used for the macros.
- ;; Have fun!
- ;;
- ;;---------------------------------------------------------------------------
- ;;---------------------------------------------------------------------------
- ;;---------------------------------------------------------------------------
- ;;---------------------------------------------------------------------------
-
-
-
-
- ;;---------------------------------------------------------------------------
- ;;------------------------------ --------------------------------
- ;;------------------------------ PUSHALL --------------------------------
- ;;------------------------------ --------------------------------
- ;;---------------------------------------------------------------------------
-
-
- PUSHALL macro
-
- push ax ; Save all the registers and the flags.
- push bp
- push bx
- push cx
- push di
- push ds
- push dx
- push es
- push si
- pushf
-
- ENDM
-
-
- ;; This macro saves all the registers and flags.
- ;;
- ;;---------------------------------------------------------------------------
- ;;---------------------------------------------------------------------------
- ;;---------------------------------------------------------------------------
- ;;---------------------------------------------------------------------------
-
-
-
-
- ;;---------------------------------------------------------------------------
- ;;------------------------------ ---------------------------------
- ;;------------------------------ POPALL ---------------------------------
- ;;------------------------------ ---------------------------------
- ;;---------------------------------------------------------------------------
-
-
- POPALL macro
-
- popf ; restore all the registers and flags
- pop si
- pop es
- pop dx
- pop ds
- pop di
- pop cx
- pop bx
- pop bp
- pop ax
-
- ENDM
-
-
- ;; This macro restores all the registers and flags.
- ;;
- ;;---------------------------------------------------------------------------
- ;;---------------------------------------------------------------------------
- ;;---------------------------------------------------------------------------
- ;;---------------------------------------------------------------------------
-
-